package com.tianze.tzkf.utils;

import android.content.Context;
import android.content.Intent;
import android.content.pm.PackageInfo;
import android.content.pm.PackageManager;

public class CallAppUtils {


    private  String packname = "com.tianze.tzkf";


    /**
     * 检查包是否存在
     *
     * @param packname
     * @return
     */
    private boolean checkPackInfo(Context context, String packname) {
        PackageInfo packageInfo = null;
        try {
            packageInfo = context.getPackageManager().getPackageInfo(packname, 0);
        } catch (PackageManager.NameNotFoundException e) {
            e.printStackTrace();
        }
        return packageInfo != null;
    }


    /**
     * 跳转app
     * @param packname
     * @return
     */
    private void startApp(Context context , String packname){
        Intent intent = context . getPackageManager().getLaunchIntentForPackage(packname);
        if (intent != null) {
           // intent.putExtra("type", "110");
            intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
            context . startActivity(intent);
        }
    }
    

}
